/**
* All Rights Reserved , Copyright (C) 2021 , 青岛鼎信通讯股份有限公司
*
* BaseCurrencyCheckItemService
* 通用检查项
*
* 修改纪录
* 2021-07-07 版本：1.0 chengengwei 创建。
* @version 版本：1.0
* @author 作者：chengengwei
* 创建日期：2021-07-07
*/
package com.topscomm.base.service.impl;

import com.topscomm.base.pojo.BaseFlowCheckItemEntity;
import com.topscomm.base.service.IBaseCurrencyCheckItemService;
import com.topscomm.base.service.impl.auto.BaseCurrencyCheckItemServiceAuto;
import com.topscomm.basic.BasicEntity;
import com.topscomm.basic.util.PrimaryKeyUtil;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

@Service(value = "baseCurrencyCheckItemService")
@Scope(value = "singleton")
public class BaseCurrencyCheckItemService extends BaseCurrencyCheckItemServiceAuto implements IBaseCurrencyCheckItemService {

    @Override
    protected void beforeInsert(BasicEntity entity) {
        super.beforeInsert(entity);
        if (entity.getId() <= 0) {// 赋值Id和单号
            long[] arrayId = PrimaryKeyUtil.GeneIDs(entity.getTableName(), 1);
            entity.setId(arrayId[0]);
            String code = String.valueOf(arrayId[0]);
            code = code.substring(0, 6) + code.substring(9);
            entity.setValue(BaseFlowCheckItemEntity.FieldCode, code);
        }
    }

}
